/*************************************************************************
	> File Name: facMode.cpp
	> Author: ma6174
	> Mail: ma6174@163.com 
	> Created Time: 2021年11月24日 星期三 21时06分56秒
 ************************************************************************/

#include<iostream>
#include "factory.h"
using namespace std;

int main()
{
	double a, b;
	cout << "请输入第一个数字: " << endl;
	cin >> a;
	cout << "请输入第二个数字: " << endl;
	cin >> b;
	char c;
	cout << "请输入运算符号: " << endl;
	cin >> c;

	IFactory* f;
	Operation* op;
	double result;
	switch (c)
	{
		case '+':
			{
				f = new AddFactory();
				op = f->create(a, b);
				result = op->getResult();
				break;
			}
		case '-':
			{
				f = new SubFactory();
				op = f->create(a, b);
				result = op->getResult();
				break;
			}
		case '*':
			{
				f = new MulFactory();
				op = f->create(a, b);
				result = op->getResult();
				break;
			}
		case '/':
			{
				f = new DivFactory();
				op = f->create(a, b);
				result = op->getResult();
				break;
			}
	}
	cout << "结果值为: " << result << endl;
	return 0;
}
